package cn.koala.key.receipt.dto;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.koala.key.entity.BorrowOrder;
import cn.koala.key.entity.BorrowOrderAddressee;
import io.swagger.annotations.ApiModelProperty;

import java.util.Date;

public class BorrowOrderImportDTO {

    /**
     * 借用的单位-门店ID
     */
    @ApiModelProperty("借用的单位-门店ID")
    @Excel(name = "门店ID" ,needMerge = true)
    private Integer borrowStoreId;

    /**
     * 借用的门店名称（企业名称）
     */
    @ApiModelProperty("借用的门店名称（企业名称）")
    @Excel(name = "借用单位" ,needMerge = true)
    private String borrowStoreName;

    /**
     * 车架号
     */
    @ApiModelProperty("车架号")
    @Excel(name = "车架号" ,needMerge = true)
    private String carVin;

    /**
     * 借用来源 1-门店、2-企业
     */
    @ApiModelProperty("借用来源 1-一嗨门店、2-企业、3-考拉门店")
    @Excel(name = "借用来源" ,needMerge = true)
    private Integer borrowSource;

    /**
     * 借用类型 1-短期、2-长期
     */
    @ApiModelProperty("借用类型 1-短期、2-长期")
    @Excel(name = "借用类型" ,needMerge = true)
    private Integer borrowType;

    /**
     * 提交时间
     */
    @ApiModelProperty("提交时间")
    private Date submissionTime;

    /**
     * 车牌号
     */
    @ApiModelProperty("车牌号")
    @Excel(name = "车牌号" ,needMerge = true)
    private String carNo;

    /**
     * 操作人工号
     */
    @ApiModelProperty("操作人工号")
    private String operator;

    /**
     * 钥匙数量
     */
    @ApiModelProperty("钥匙数量")
    @Excel(name = "钥匙数量" ,needMerge = true)
    private Integer keyCount;

    /**
     * 订单状态 1-未提交、2-未审核、3-已审核、4-未确认、5-已拒绝、6-已借出、7-归还中、8-已完成、9-已作废
     */
    @ApiModelProperty("订单状态 1-未提交 / 2-未审核 / 3-已审核 / 4-未确认 / 5-已拒绝 / 6-已借出 / 7-归还中 / 8-已完成 / 9-已作废")
    private Integer orderStatus;

    @ApiModelProperty("城市id")
    @Excel(name = "城市ID" ,needMerge = true)
    private Integer cityId;

    @ApiModelProperty("城市名称")
    @Excel(name = "城市名称" ,needMerge = true)
    private String cityName;

    @ApiModelProperty("备注")
    @Excel(name = "备注" ,needMerge = true)
    private String remark;

    /**
     * 收件人
     */
    @ApiModelProperty("收件人")
    @Excel(name = "收件人" ,needMerge = true)
    private String recipient;

    /**
     * 借用人工号
     */
    @ApiModelProperty("借用人")
    private String loanName;

    /**
     * 借用方式 1-邮递、2-自取
     */
    @ApiModelProperty("借用方式 1-邮递、2-自取")
    private Integer recipientType;

    /**
     * 收件人联系电话
     */
    @ApiModelProperty("收件人联系电话")
    @Excel(name = "联系电话" ,needMerge = true)
    private String receiverCallPhone;

    /**
     * 收件地址
     */
    @ApiModelProperty("收件地址")
    @Excel(name = "地址" ,needMerge = true)
    private String receiverAddress;

    /**
     * 快递单号
     */
    @ApiModelProperty("快递单号")
    private String expressNo;


    @ApiModelProperty("证件号")
    private String idNumber;

    public Integer getBorrowStoreId() {
        return borrowStoreId;
    }

    public void setBorrowStoreId(Integer borrowStoreId) {
        this.borrowStoreId = borrowStoreId;
    }

    public String getBorrowStoreName() {
        return borrowStoreName;
    }

    public void setBorrowStoreName(String borrowStoreName) {
        this.borrowStoreName = borrowStoreName;
    }

    public String getCarVin() {
        return carVin;
    }

    public void setCarVin(String carVin) {
        this.carVin = carVin;
    }

    public Integer getBorrowSource() {
        return borrowSource;
    }

    public void setBorrowSource(Integer borrowSource) {
        this.borrowSource = borrowSource;
    }

    public Integer getBorrowType() {
        return borrowType;
    }

    public void setBorrowType(Integer borrowType) {
        this.borrowType = borrowType;
    }

    public Date getSubmissionTime() {
        return submissionTime;
    }

    public void setSubmissionTime(Date submissionTime) {
        this.submissionTime = submissionTime;
    }

    public String getCarNo() {
        return carNo;
    }

    public void setCarNo(String carNo) {
        this.carNo = carNo;
    }

    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public Integer getKeyCount() {
        return keyCount;
    }

    public void setKeyCount(Integer keyCount) {
        this.keyCount = keyCount;
    }

    public Integer getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(Integer orderStatus) {
        this.orderStatus = orderStatus;
    }

    public Integer getCityId() {
        return cityId;
    }

    public void setCityId(Integer cityId) {
        this.cityId = cityId;
    }

    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getRecipient() {
        return recipient;
    }

    public void setRecipient(String recipient) {
        this.recipient = recipient;
    }

    public String getLoanName() {
        return loanName;
    }

    public void setLoanName(String loanName) {
        this.loanName = loanName;
    }

    public Integer getRecipientType() {
        return recipientType;
    }

    public void setRecipientType(Integer recipientType) {
        this.recipientType = recipientType;
    }

    public String getReceiverCallPhone() {
        return receiverCallPhone;
    }

    public void setReceiverCallPhone(String receiverCallPhone) {
        this.receiverCallPhone = receiverCallPhone;
    }

    public String getReceiverAddress() {
        return receiverAddress;
    }

    public void setReceiverAddress(String receiverAddress) {
        this.receiverAddress = receiverAddress;
    }

    public String getExpressNo() {
        return expressNo;
    }

    public void setExpressNo(String expressNo) {
        this.expressNo = expressNo;
    }

    public String getIdNumber() {
        return idNumber;
    }

    public void setIdNumber(String idNumber) {
        this.idNumber = idNumber;
    }

    public BorrowOrderDTO convertBorrowOrderDTO(String userCode) {
        BorrowOrderDTO orderDTO = new BorrowOrderDTO();
        BorrowOrder order = new BorrowOrder();
        BorrowOrderAddressee addressee = new BorrowOrderAddressee();

        orderDTO.setBorrowOrder(order);
        orderDTO.setBorrowOrderAddressee(addressee);

        order.setOrderStatus(2);
        order.setRemark(remark == null ? "" : remark);
        order.setSubmissionTime(new Date());
        order.setBorrowSource(borrowSource == null ? 1 : borrowSource);
        order.setBorrowStoreId(borrowStoreId == null ? 0 : borrowStoreId);
        order.setBorrowStoreName(borrowStoreName == null ? "" : borrowStoreName);
        order.setBorrowType(borrowType == null ? 1 : borrowType);
        order.setCarNo(carNo == null ? "" : carNo);
        order.setCarVin(carVin == null ? "" : carVin);
        order.setCityId(cityId == null ? 0 : cityId);
        order.setCityName(cityName == null ? "" : cityName);
        order.setKeyCount(keyCount == null || keyCount == 0 ? 1 : keyCount);
        order.setOperator(userCode == null ? "10003" : userCode);

        addressee.setRecipient(recipient == null ? "" : recipient);
        addressee.setReceiverCallPhone(receiverCallPhone == null ? "" : receiverCallPhone);
        addressee.setReceiverAddress(receiverAddress == null ? "" : receiverAddress);
        addressee.setRecipientType(2);
        return orderDTO;
    }

}
